package com.javaweb.servlet.action;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/user")
public class UserServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out =response.getWriter();
        ServletContext application = request.getServletContext();
        String name = (String) application.getAttribute("name");
        String password = (String) application.getAttribute("password");
        out.print("<h1>个人简介</h1>");
        out.print("<hr>");
        out.print("<h2>姓名："+name+"</h2>");
        out.print("<h2>密码："+password+"</h2>");
        out.print("<h2>个性签名：随风飞行</h2>");
        out.print("<hr>");
        out.print("<a href='/model02/loginSucess.jsp'>返回首页</a>");

    }
}
